﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MMPS.Business;
using MMPS.Entity.ViewModel;

namespace MMPS.Controllers
{
    public class MemCardsInfoController : Controller
    {
        MemCardsService memCardsService = new MemCardsService();
        // GET: MemCards
        public ActionResult MemCardsIndex()
        {
            return View();
        }
        #region    查询
        public ActionResult GetMemCardsIndex(MemCardsPageViewModel viewModel)
        {
         var moel= memCardsService.MerCardInfo(viewModel);
            return Json(moel.Data);
        }
        #endregion
        #region  添加视图
        public ActionResult MemCardsCreate()
        {
            
            //绑定下拉框
         var model= memCardsService.GetList(m => true).Select(m => new SelectListItem {Text= m.CardLevels.CL_LevelName, Value= m.MC_ID.ToString() }).ToList();
            model.Insert(0,new SelectListItem() { Text="请选择",Value="0"});
            ViewBag.CL_ID = model;
            return View(); 
        }
        #endregion


        #region  添加信息
        /// <summary>
        /// 调用底层的方法
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public ActionResult MemCardsCreate(MemCardsListViewModel viewModel)
        {
            var model = memCardsService.MemCardsCreateInfo(viewModel);
            return Json(model);
        }
        #endregion



        #region  根据id查询对应信息
        #endregion



        #region    修改
        #endregion


        #region   删除
        #endregion
    }
}